<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$category.name} {$category.page_title} {$site_info.site_name|default=''}</title>
<meta name="keywords" content="{$category.page_keywords},{$site_info.site_seo_keywords|default=''}"/>
<meta name="description" content="{$category.page_description},{$site_info.site_seo_description|default=''}">
<include file="public@head"/>

</head>
<body>
    <include file='public@nav'/>
    
    <!-- banner -->
    <include file='public@banner'/>

    <div class="main layout clearfix">
        
        <!-- 分类 -->
        <include file='public@category'/>

        <div class="oright fr">
            <!-- 面包 -->
            <include file='public@breadcrumb'/>

            <php>
                $limit = empty($theme_vars['data_limit']) ? 5 : $theme_vars['data_limit'];
                if( $limit <= 0 ){
                    $limit = 5;
                }

                /*顶级分类ID*/
                $top_category_id = empty($theme_vars['top_category_id']) ? 1 : $theme_vars['top_category_id'];
                
                /*顶级分类的子分类*/
                $categorys = sp_get_child_terms($top_category_id);
                
                /*当前分类cat_id是否为顶级分类,若是则查询该分类及其子分类下的文章,否则仅查询该分类下的文章*/
                $ids       = [$cat_id];
                $all_class = '';
                if( $top_category_id == $cat_id ){
                    $all_class = 'on';
                    foreach ($categorys as $v) {
                        $ids[] = $v['id'];
                    }
                }else{
                    $new_category = model('portal_category')
                                 -> where('id', $top_category_id)
                                 -> order('list_order asc,id desc')
                                 -> find();
                    $category['name']        = $new_category['name'];
                    $category['description'] = $new_category['description'];
                }
            </php>

            <div class="case">
                <ul>
                    <php>
                        $order = SO;
                    </php>

                    <portal:articles item="vo" order="$order" page="$limit" field="post.id,post_title,published_time,post_excerpt,post.more,category_id"
                            relation="categories"
                            categoryIds="$ids"
                            returnVarName="articles_data">
                    <li>
                        <a href="{:cmf_url('portal/Article/index',array('id'=>$vo['id'],'cid'=>$vo['category_id']))}">
                            <div class="pic">
                                <img src="{:cmf_get_image_url($vo.more.thumbnail)}" style="width:220px;height:160px;">
                            </div>
                            <div class="text" style="    min-height: 110px;">
                                <h4>{$vo.post_title}</h4>
                                <div class="txt">
                                    {$vo.post_excerpt}
                                </div>
                            </div>
                        </a>
                    </li>
                    </portal:articles>
                    
                </ul>
                <div class="pages">
                    <page/>
                </div>
            </div>
        </div>
    </div>
    <include file='public@footer'/>
</body>
</html>

<include file='public@scripts'/>
<script type="text/javascript" src="__TMPL__/public/assets/js/lightbox.js"></script>

